package org.voyager.service.admin.ad.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.voyager.common.beans.JsonResult;
import org.voyager.service.admin.ad.po.AdResource;
import org.voyager.service.admin.ad.service.AdResourceService;
import org.voyager.service.admin.ad.vo.AdResourceVo;

import com.alibaba.fastjson.JSONObject;

@RestController
@RequestMapping("/ad/resource")
public class AdResourceController {

	@Autowired
	private AdResourceService adResourceService;
	
	@PostMapping("/add")
	public JsonResult add(@RequestBody AdResource adResource) {
		return adResourceService.add(adResource);
	}
	
	@PostMapping("/del")
	public JsonResult del(@RequestBody JSONObject jo) {
		return adResourceService.del(jo.getString("id"));
	}
	
	@PostMapping("/list")
	public JsonResult pageList(@RequestBody AdResourceVo adResourceVo) {
		return adResourceService.pageList(adResourceVo);
	}
	
}
